package com.movie.mybatis.web;

import com.movie.mybatis.service.impl.MovieUserServlet;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

@WebServlet({"/record/list", "/record/look","/record/save","/record/detail"})
public class MovieUserWebServlet extends HttpServlet {
    private final MovieUserServlet movieUserServlet = new MovieUserServlet();
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String servletPath = request.getServletPath();
        if ("/record/list".equals(servletPath)) {
            movieUserServlet.doList(request, response);
        } else if ("/record/look".equals(servletPath)) {
            movieUserServlet.doLook(request, response);
        }else if ("/record/save".equals(servletPath)) {
            movieUserServlet.dosave(request, response);
        }else if ("/record/detail".equals(servletPath)) {
            movieUserServlet.doRecordDetail(request, response);
        }
    }
}
